<template>
	<view class="userCom">
		<giantScreen :userInfo='userInfo'></giantScreen>
		<korgenlirim></korgenlirim>
		<!-- <advertisement></advertisement> -->
		<tizimlik></tizimlik>
		<azaelan :azaelan="azaelan"></azaelan>
		<bottomTip></bottomTip>
	</view>
</template>

<script>
	import {
		getUserSession
	} from '@/api/view.js'
	import {
		getAzaElanData
	} from '@/api/user.js'
	import {
		userInfoMixin
	} from '@/mixins/userInfo.js'
	import giantScreen from '@/components/user/giantScreen.vue'
	import korgenlirim from '@/components/user/korgenlirim.vue'
	import advertisement from '@/components/user/advertisement.vue'
	import tizimlik from '@/components/user/tizimlik.vue'
	import azaelan from '@/components/user/azaelan.vue'
	import bottomTip from '@/components/user/bottomTip.vue'
	export default {
		mixins: [userInfoMixin],
		props: {
			isOnShow: {
				type: Boolean,
				require: true,
			}
		},
		components: {
			giantScreen,
			korgenlirim,
			advertisement,
			tizimlik,
			azaelan,
			bottomTip,
		},
		data() {
			return {
				azaelan: {},
			}
		},
		async mounted() {
			this.isOnShow_init()
			this.getAzaElan()
		},
		methods: {
			async getAzaElan() {
				const res = await getAzaElanData()
				if (res) {
					this.azaelan = res.data.data
				} else {
					uni.showToast({
						title: '请求失败',
						icon: 'error'
					})
				}
			},
			isOnShow_init() {
				this.$watch('isOnShow', (isOnShow) => {
					if (isOnShow) {
						this.onShowEvent()
						this.$emit('setIsOnShow', false)
					}
				}, {
					immediate: true,
					deep: true
				})
			},
			async onShowEvent() {
				this.$emit('setLoading', true)
				this.userInfo_init()
				this.$emit('setLoading', false)
			},
		}
	}
</script>

<style>
	.userCom {
		padding-bottom: 68px;
		overflow: hidden;
	}
</style>